package com.your.company.demo.web.v1_0_0;

import java.io.IOException;

import com.strato.annotation.osgi.v1_0_0.service.OsgiWired;
import com.strato.mvc.annotation.v1_0_0.annotation.method.PathVariable;
import com.strato.mvc.annotation.v1_0_0.annotation.method.RequestMapping;
import com.strato.mvc.annotation.v1_0_0.annotation.type.Controller;
import com.strato.mvc.api.v1_0_0.model.ModelAndView;
import com.your.company.demo.service.api.v1_0_0.HelloService;

@Controller
@com.strato.mvc.annotation.v1_0_0.annotation.type.RequestMapping("/demo/2")
public class Controllers2 {

	@OsgiWired(query="(id=simple)")
	private HelloService simpleHelloService;
	
	@OsgiWired(query="(id=persist)")
	private HelloService persistHelloService;
	
	@RequestMapping("/hello/simple/{name}")
	public String helloSimple(@PathVariable String name,ModelAndView mav) throws IOException{
		String fullName=simpleHelloService.getFullName(name);
		mav.getModel().put("name", fullName);
		return "velocity/hello4";
	}
	
	@RequestMapping("/hello/persist/{name}")
	public String helloPersist(@PathVariable String name,ModelAndView mav) throws IOException{
		String fullName=persistHelloService.getFullName(name);
		mav.getModel().put("name", fullName);
		return "velocity/hello4";
	}
}
